package com.vrv.im.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.vrv.im.domain.AnnexRelatedBean;
import com.vrv.im.persistence.AnnexRelatedMapper;
import com.vrv.im.service.AnnexRelatedService;

@Service
public class AnnexRelatedServiceImpl implements AnnexRelatedService{

	@Autowired
	private AnnexRelatedMapper mapper;
	public List<Long> getFileID(long leadID, byte type) {
		AnnexRelatedBean b=new AnnexRelatedBean();
		b.setLeadID(leadID);
		b.setTypeID(type);
		return mapper.getFileID(b);
	}
	@Override
	public void addRelation(byte type, long leadID, List<Long> fileIDs) {
		if(fileIDs!=null&&fileIDs.size()>0){
			for(long fileID:fileIDs){
				AnnexRelatedBean b=new AnnexRelatedBean();
				b.setLeadID(leadID);
				b.setTypeID(type);
				b.setFileID(fileID);
				mapper.addRelation(b);
			}
		}
		
	}

	

}
